package com.xxxx.web.entity;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.xxxx.web.dto.*;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import org.apache.commons.beanutils.BeanUtils;

import java.lang.reflect.InvocationTargetException;

/**
 * 货主表表
 */
@Data
@TableName("`Customer`")
public class Customer extends BaseEntity {


    /**
     * 联系人
     */
    @JsonProperty("ContactPerson")
    @TableField(value = "ContactPerson", updateStrategy = FieldStrategy.IGNORED)
    private String ContactPerson;

    /**
     * 联系电话
     */
    @JsonProperty("Phone")
    @TableField(value = "Phone", updateStrategy = FieldStrategy.IGNORED)
    private String Phone;

    /**
     * 货主名称
     */
    @JsonProperty("OwnerName")
    @TableField(value = "OwnerName", updateStrategy = FieldStrategy.IGNORED)
    private String OwnerName;

    /**
     * 地址
     */
    @JsonProperty("Address")
    @TableField(value = "Address", updateStrategy = FieldStrategy.IGNORED)
    private String Address;

    /**
     * 电子邮箱
     */
    @JsonProperty("Email")
    @TableField(value = "Email", updateStrategy = FieldStrategy.IGNORED)
    private String Email;

    /**
     * 仓库
     */
    @JsonProperty("WarehouseId")
    @TableField(value = "WarehouseId", updateStrategy = FieldStrategy.IGNORED)
    private Integer WarehouseId;

    /**
     * 把货主表实体转换成货主表传输模型
     */
    public CustomerDto MapToDto() throws InvocationTargetException, IllegalAccessException {
        CustomerDto CustomerDto = new CustomerDto();

        BeanUtils.copyProperties(CustomerDto, this);

        return CustomerDto;
    }

}
